package cn.iocoder.yudao.module.xkfz.controller.admin.excel;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.xkfz.domain.entity.talentEchelon.TalentEchelon;
import cn.iocoder.yudao.module.xkfz.domain.excel.entity.PlatformConstruction;
import cn.iocoder.yudao.module.xkfz.service.clinicalHealthCare.ClinicalHealthCareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * 临床医疗部分导入
 */
@RestController
@RequestMapping("/clinicalHealthCareImport")
public class ClinicalHealthCareImportController {

    @Autowired
    ClinicalHealthCareService clinicalHealthCareService;

    /**
     * 国家、省级医疗服务平台建设情况
     * @param file
     * @param year
     * @return
     * @throws IOException
     */
    @PostMapping("importPlatformConstruction")
    public CommonResult<Boolean> importPlatformConstruction(@RequestParam("file") MultipartFile file,
                                                              @RequestParam("year")  String year,
                                                              @RequestParam("indicatorName")  String indicatorName
    ) throws IOException {
        //读Excel数据
        List<PlatformConstruction> list = ExcelUtils.read(file, PlatformConstruction.class);
        return success(clinicalHealthCareService.importPlatformConstruction(list, year,indicatorName));
    }
}
